import { allowPaste } from "@/views/paint/modules/data/stage";
import { App } from "vue";

export const noPaste = (app: App) => {
  app.directive("noPaste", {
    created(el: HTMLElement) {
      nextTick(() => {
        const focus = () => {
          allowPaste.value = false;
        };
        const blur = () => {
          allowPaste.value = true;
        };
        el.addEventListener("focus", focus);
        el.addEventListener("blur", blur);
      });
    }
  });
};
